<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<%@ include file="/web/header.jsp"%>
<title>注册</title>
</head>
<body>

<fieldset class="layui-elem-field" style="margin:20px; padding: 20px;">
	<legend>注册</legend>
	
	<div class="layui-field-box">
		<form class="layui-form layui-form-pane" method="post">
			<div class="layui-form-item">
				<label class="layui-form-label">账号</label>
				<div class="layui-input-inline">
					<input type="text" name="code" class="layui-input" autocomplete="off"
					       lay-verify="required" placeholder="请输入账号"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">密码</label>
				<div class="layui-input-inline">
					<input type="password" name="pass" class="layui-input" autocomplete="off"
					       lay-verify="required" placeholder="请输入密码"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">姓名</label>
				<div class="layui-input-inline">
					<input type="text" name="name" class="layui-input" autocomplete="off"
					       lay-verify="required" placeholder="请输入姓名"/>
				</div>
			</div>
			<div class="layui-form-item">
				<!-- <label class="layui-form-label"></label> -->
				<div class="layui-input-inline">
					<input value="注册"  type="button" class="layui-btn" 
					       lay-submit lay-filter="reg" /> 
					<input value="重置"  type="reset" 
					       class="layui-btn layui-btn-primary" />
				</div>
				<input value="返回登录" type="button" 
				       class="layui-btn" onclick="goJspLogin()" />
			</div>
<!-- 			<input type="hidden" name="action" value="reg" /> -->
		</form>
	</div>
</fieldset>
<script type="text/javascript">
// 	form.on('submit(reg)', function(data) {
// //            console.log(data)
// 		$.ajax({
// 			url : con.app_server + '/Employee/insert',
// 			data : data.field,//{usercode:aa,password:bb,...}
// 			dataType : 'text',
// 			type : 'post',
// 			success : function(data) {
// 				var code =data.code;
// 				if (code == 1) {
// 					layer.msg('注册成功');
// 				} else if (code == 2) {
// 					layer.msg('账号已存在');
// 				} else {
// 					layer.msg('注册失败');
// 				}
// 			}
// 		})
// 	});
	formSubmit('/Employee/insert', 'submit(reg)', false, function(data) {
		if (data == 1) {
			layer.msg('注册成功');
			//$("input[type='reset']").click();
		} else if (data == 2) {
			layer.msg('账号已存在');
		} else {
			layer.msg('注册失败');
		}
	});
</script>

</body>
</html>